<script language="javascript">
var active=false;
function resetrecord(obj,id){
value = $(obj).text();
if( active == true ) return;
save = '<img src="img/save.png" border="0">';
undo = '<img src="img/undo.png" border="0">';
line = "<input name='category"+id+"' value=\""+value+"\">&nbsp;<a href='javascript:saverecord(\""+id+"\");'>"+save+"</a>&nbsp;&nbsp;<a href='javascript:clearrecord(\""+id+"\",\""+value+"\");'>"+undo+"</a>";
$(obj).empty();
$(obj).append(line);
}
function saverecord(id){
val = $("input[@name=category"+id+"]").val();
url = banksurl+"banksapi.php?savecity="+id+"&value="+val;
chars =" " || "\\s";
val=val.replace(new RegExp("^[" + chars + "]+", "g"), "");
val=val.replace(new RegExp("[" + chars + "]+$", "g"), "");
if ( val.length <1 ){
alert("Data should not be empty");
return;
}
$.get(url, function (data){ } );
clearrecord(id,val);
}
function clearrecord(id,value){
$("#category"+id).empty();
$("#category"+id).append(value);
}
</script>
<div class="title">{ %lang c0}</div>
<!-- Categories list -->
{ %if {%count #data} eq 0 }<div class="message">{ %lang c11}</div>{/if}
<div id="contentarea">
<table cellspacing="4" cellpadding="4">
{ %loop #data }
<tr><td><div id="category{#data[i][cat_id]}" ondblclick="javascript:resetrecord(this,'{#data[i][cat_id]}');">{#data[i][cat_name]}</div></td> <td>{ #data[i][cat_alias]}</td> <td><a href="{%action(this,delete={#data[i][cat_id]})}"> { %lang c4}</a> </td> </tr>
{/loop}
</table>
</div>
<!-- New category -->
<form action="" method="post">
<table cellspacing="4" cellpadding="4">
<td colspan="2"><b>{ %lang c1}</b></td>
<tr> <td>{ %lang c2}*</td> <td><input type="text" name="name"> </td> </tr>
<tr> <td>Alias:</td> <td><input type="text" name="alias"> </td> </tr>
<tr> <td>{ %lang c7}</td> <td><input type="text" name="description"> </td> </tr>
<td colspan="2"><input type="Submit" name="Submit" value="{ %lang c3}"></td>
</table>
</form>